<?php

namespace app\admin\model;

use think\Model;

/**
 * Withdrawal
 */
class UserVip extends Model
{
    // 表名
    protected $name = 'user_vip';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = true;
    protected $createTime = 'time'; // 自定义创建时间字段名

    // 字段类型转换
    protected $type = [
        'time'   => 'timestamp:Y-m-d H:i:s',
        'handle_time' => 'timestamp:Y-m-d H:i:s',
    ];

  	public function user()
    {
        return $this->hasOne(\app\admin\model\User::class, 'id', 'uid')->field('id, wx_name, mobile, money, money_2, (money + money_2) as sum'); // 指定查询的字段;
    }

}